package archer.application.elastic.mock.core.service.system;

import archer.application.elastic.mock.core.service.user.UserService;
import archer.framework.common.service.BaseService;
import archer.framework.protocol.result.ExecuteResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 后端系统用户Service
 *
 * @author christ
 * @date 2016/6/7
 */
@Service
public class StaffService extends BaseService {

    private String type = "STAFF";

    @Autowired
    UserService userService;

    /**
     * 登录
     *
     * @param loginName
     * @param password
     * @return
     */
    public ExecuteResult login(String loginName, String password) {

        if (isEmpty(loginName)) {
            return paramNull("登录名不能为空");
        }

        if (isEmpty(password)) {
            return paramNull("密码不能为空");
        }

        return userService.loginNameLogin(loginName, password, type);
    }


}

